<template>
	<div class="login_bg">
		<div class="video-background">
			<video 
				autoplay 
				muted 
				loop 
				playsinline
				class="bg-video"
			>
				<!-- 使用科技感视频作为背景 -->
				<source :src="videoUrl" type="video/mp4">
				您的浏览器不支持视频标签
			</video>
			<!-- 模糊滤镜和遮罩层 -->
			<div class="video-overlay"></div>
		</div>

		<div class="login_body">
			<div class="login_adv">
				<div class="login_adv__title">
					<div class="login_adv_top">
						<img :alt="$CONFIG.APP_NAME" src="img/logo1.png">
					</div>

					<div class="login_adv__bottom">
						© {{$CONFIG.APP_NAME}} {{$CONFIG.APP_VER}}
						©  中浩 版权所有 
					</div>
				</div>
			</div>
			<div class="login_main">
				<div class="login_config">
					<!-- <el-button :icon="config.dark?'el-icon-sunny':'el-icon-moon'" circle type="info" @click="configDark"></el-button> -->
					<!-- <el-dropdown trigger="click" placement="bottom-end" @command="configLang">
						<el-button circle>
							<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z" fill="currentColor"></path><path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z" fill="currentColor"></path></svg>
						</el-button>
						<template #dropdown>
							<el-dropdown-menu>
								<el-dropdown-item v-for="item in lang" :key="item.value" :command="item" :class="{'selected':config.lang==item.value}">{{item.name}}</el-dropdown-item>
							</el-dropdown-menu>
						</template>
					</el-dropdown> -->
				</div>
				<div class="login-form">
					<div class="login-header">
						<div class="logo">
							<!-- <img :alt="$CONFIG.APP_NAME" src="img/logo.png"> -->
							<label>AI Transformation</label>
							 <h3>大模型决策支持平台</h3>
							
						</div>
					</div>
					<password-form></password-form>
				</div>
			</div>
		</div>
	</div>
	<el-dialog v-model="showWechatLogin" :title="$t('login.wechatLoginTitle')" :width="400" destroy-on-close>
		<div class="qrCodeLogin">
			<!-- <sc-qr-code class="qrCode" :text="WechatLoginCode" :size="200"></sc-qr-code> -->
			<p class="msg">{{$tc('login.wechatLoginMsg', 1)}}<br/>{{$tc('login.wechatLoginMsg', 2)}}</p>
			<div class="qrCodeLogin-result" v-if="isWechatLoginResult">
				<el-result icon="success" :title="$tc('login.wechatLoginResult', 1)" :sub-title="$tc('login.wechatLoginResult', 2)"></el-result>
			</div>
		</div>
	</el-dialog>
</template>

<script>
	import passwordForm from './components/passwordForm'

	export default {
		components: {
			passwordForm
		},
		data() {
			return {
				videoUrl: require('../../../public/img/login_bg.mp4'),
				config: {
					lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
					dark: this.$TOOL.data.get('APP_DARK') || false
				},
				lang: [
					{
						name: '简体中文',
						value: 'zh-cn',
					},
					{
						name: 'English',
						value: 'en',
					}
				],
				WechatLoginCode: "",
				showWechatLogin: false,
				isWechatLoginResult: false
			}
		},
		watch:{
			'config.dark'(val){
				if(val){
					document.documentElement.classList.add("dark")
					this.$TOOL.data.set("APP_DARK", val)
				}else{
					document.documentElement.classList.remove("dark")
					this.$TOOL.data.remove("APP_DARK")
				}
			},
			'config.lang'(val){
				this.$i18n.locale = val
				this.$TOOL.data.set("APP_LANG", val)
			}
		},
		created: function() {
			this.$TOOL.data.remove("TOKEN")
			this.$TOOL.data.remove("USER_INFO")
			this.$TOOL.data.remove("MENU")
			this.$TOOL.data.remove("ENMU")
			this.$TOOL.data.remove("PERMISSIONS")
			this.$TOOL.data.remove("DASHBOARDGRID")
			this.$TOOL.data.remove("grid")
			this.$store.commit("clearViewTags")
			this.$store.commit("clearKeepLive")
			this.$store.commit("clearIframeList")
		},
		methods: {
			configDark(){
				this.config.dark = this.config.dark ? false : true
			},
			configLang(command){
				this.config.lang = command.value
			},
			wechatLogin(){
				this.showWechatLogin = true
				this.WechatLoginCode = "SCUI-823677237287236-" + new Date().getTime()
				this.isWechatLoginResult = false
				setTimeout(()=>{
					this.isWechatLoginResult = true
				},3000)
			}
		}
	}
</script>

<style scoped>
	.login_bg {
		width: 100%;
		height: 100vh;
		background-color: #555;
		overflow: hidden;
		/* background-size: cover;
		background-repeat: no-repeat;
		background-image: url('/public/img/login_bg.jpg'); */
	}
	.video-background {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		z-index: 1;
		overflow: hidden;
	}
	.bg-video {
		position: absolute;
		top: 50%;
		left: 50%;
		min-width: 100%;
		min-height: 100%;
		transform: translate(-50%, -50%);
		object-fit: cover;
		/* 视频模糊效果 */
		/* filter: blur(4px);
		-webkit-filter: blur(4px); */
		}

		.video-overlay {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		/* 半透明遮罩，增强科技感 */
		/* background: rgba(2, 7, 26, 0.75); */
		background: linear-gradient(120deg, rgba(2, 7, 26, 0.1) 0%, rgba(0, 0, 0, 0.5) 100%);
		}
	.login_body {
		width: 98%;
		display: flex;
		position: relative;
		align-items: center;
		height: 100vh;
		margin: 0 auto;
		justify-content:flex-end;
	}
	.login_adv {
		flex: 1;
		padding-top: 50px;
	}
	.login_adv__title h2 {
		width: 100%;
		color: #fff;
		font-size: 52px;
		letter-spacing: 6px;
		text-shadow: 2px 2px 2px rgba(0,0,0,0.5);
	}
	.login_adv__title h4 {
		width: 100%;
    font-size: 20px;
    color: #fff;
    margin-top: 28px;
    margin-bottom: 40px;
		font-weight: normal;
	}
	.login_adv__title p {
		color: rgba(255,255,255,0.8);
    font-size: 16px;
	}
	.login_adv_top {
		position: absolute;
    top: 24px;
		left: 0;
		z-index: 9;
		width: 100%;
    color: #fff;
    font-size: 14px;
		display: flex;
		align-items: center;
		
		

	}
	.login_adv_top img {
		/* width: 40px; */
		height: 44px;
		margin-right: 10px;
	}
	.login_adv_top span {
		font-size: 18px;
		opacity: .8;
		position: relative;
		top: -2px;

	}
	.login_adv__bottom {
		position: absolute;
    bottom: 16px;
    text-align: center;
    width: 100%;
    color: #fff;
    font-size: 14px;
		text-align: center;
		z-index: 9;
		opacity: .65;
	}
	.login_adv__mask {position: absolute;top:0px;left:0px;right: 0px;bottom: 0px;background: rgba(0,0,0,0.5);z-index: 1;}

	.login_main {
		/* box-shadow: 1px 6px 20px 0px rgba(0,0,0,0.2); */
    /* background: #fff; */
    position: relative;
    z-index: 9;
    /* height: 360px; */
    width: 440px;
    border-radius: 8px;
    display: flex;
    align-items: center;
		padding-top: 10px;
		margin-right: 60px;
	}
	.login-form {width: 400px;margin: auto; padding: 20px 0 16px;}
	.login-header {margin-bottom: 24px;}
	.login-header .logo { color: #fff;}
	/* .login-header .logo img {width: 40px;height: 40px;vertical-align: bottom;margin-right: 14px;} */
	.login-header .logo h3 {font-weight: normal; font-size: 32px;}
	.login-header .logo label {font-size: 32px;}
	.login-oauth {display: flex;justify-content:space-around;}
	.login-form .el-divider {margin-top:40px;}

	.login-form:deep(.el-tabs) .el-tabs__header {margin-bottom: 25px;}
	.login-form:deep(.el-tabs) .el-tabs__header .el-tabs__item {font-size: 14px;}

	.login-form:deep(.login-forgot) {text-align: right;}
	.login-form:deep(.login-forgot) a {color: var(--el-color-primary);}
	.login-form:deep(.login-forgot) a:hover {color: var(--el-color-primary-light-3);}
	.login-form:deep(.login-reg) {font-size: 14px;color: var(--el-text-color-primary);}
	.login-form:deep(.login-reg) a {color: var(--el-color-primary);}
	.login-form:deep(.login-reg) a:hover {color: var(--el-color-primary-light-3);}

	.login_config {position: absolute;top:32px;right: 24px;}

	.login-form:deep(.login-msg-yzm) {display: flex;width: 100%;}
	.login-form:deep(.login-msg-yzm) .el-button {margin-left: 10px;--el-button-size:42px;}

	.qrCodeLogin {text-align: center;position: relative;padding: 20px 0;}
	.qrCodeLogin img.qrCode {background: #fff;padding:20px;border-radius:10px;}
	.qrCodeLogin p.msg {margin-top: 15px;}
	.qrCodeLogin .qrCodeLogin-result {position: absolute;top:0;left:0;right: 0;bottom: 0;text-align: center;background: var(--el-mask-color);}

	@media (max-width: 1200px){
		.login-form {width: 340px;}
	}
	@media (max-width: 1000px){
		.login_main {display: block; height: auto; margin: 0 auto; padding-bottom: 10px;}
		/* .login_main .login_config {} */
		.login-form {
			width: 100%;
			padding: 0px 24px;
			margin-top: 16px;
		}
		.login_adv {display: none;}
	}
</style>
